home *** CD-ROM | disk | FTP | other *** search
- /*
- Copyright Cornell University 1986. All rights are reserved.
-
- screenpaint.c contains routines using both direct-to-screen
- bit-painting (ds) routines defined in emlib and QuickDraw calls to draw
- the screen. Each basic call comes in two flavors to support
- either the ds or qd drawing mode; the application uses routine vectors
- which are reset so that the correct mode
- is automatically used.
-
- updatewind is the screen update call.
-
- */
-
- #include <em.h>
-
- #include <3270.h>
- #include <rcodes.h>
- #include <h19.h>
- #include "menudefs.h"
-
-
- #define ATUNPROT 0
- #define ATPROT 8
-
- #define ATNORM 0
- #define ATSENSE 2
- #define ATINTENSE 4
- #define ATINVIS 6
-
- #define ATFORE 0
- #define ATBACK 1
-
-
-
- char * blankstart =
- " \
- ";
- /* > 132 blanks */
-
- short inscreen_service; /* don't allow reentrant calls-might work, but... */
-
- /* go through the array of connections and update any that need screen updates */
-
- screen_service()
- {
- struct winds ** conp = conns;
- struct winds * conend = &conp[conncount];
- register struct winds * twp;
- short cursortime;
- short giveupdate;
- GrafPtr oport;
- GrafPtr frontwind = FrontWindow();
-
- if (inemulator || mfbackonly)
- return(-1);
-
- if (inscreen_service)
- return;
- inscreen_service = TRUE;
-
- giveupdate = cupdatewait(keydp);
- if (cticks > tickcursor) {
- /* do this stuff but 60 times/second */
- maccursor(giveupdate);
- /* change/track cursor in key emwindow; leaves port set to keydp->emwindow */
- tickcursor = cticks + 1;
- }
- #ifdef NUTS
- /* hey, this is stupid! */
- if (giveupdate) {
- /* no drawing should be done anyway */
- inscreen_service = FALSE;
- return(-1);
- }
- #endif
-
- if (cticks > cursalarm) {
- setcursalarm();
- cursortime = TRUE;
- }
- else
- cursortime = FALSE;
-
- /* go through window list to see who needs service */
- for ( ; conp < conend ; ) {
- twp = *conp++;
- if (twp == NULL)
- continue;
-
- if (twp->emwindow == NULL)
- /* has no window to update... */
- continue;
-
- if (cursortime || twp->cursorwait) {
- if (twp->curson == FALSE) {
- /* make sure the cursor gets turned on */
- getcontext(twp);
- cursorblink();
- }
- else if (twp->emwindow == frontwind && !mfbackground) {
- /* make sure the cursor blinks if front window */
- getcontext(twp);
- cursorblink();
- }
- if (twp->textwindow == frontwind && !mfbackground) {
- GetPort(&oport);
- SetPort(twp->textwindow);
- TEIdle(twp->texthand);
- SetPort(oport);
- }
- }
-
- #ifdef MACTCP
- if (cticks > tickstats) {
- if (twp->conntype == CONN_MACTCP) {
- tcp_drawcount(twp);
- }
- }
- #endif
- #ifdef DUALTCP
- if (cticks > tickstats) {
- if (twp->conntype == CONN_MACTCP) {
- tcp_drawcount(twp);
- }
- if (twp->conntype == CONN_CUTCP) {
- extern unsigned long ipsnd;
- extern unsigned long iprcv;
-
- if (twp->in_cnt != iprcv) {
- twp->in_cnt = iprcv;
- getcontext(twp);
- drawincount();
- }
- if (twp->out_cnt != ipsnd) {
- twp->out_cnt = ipsnd;
- getcontext(twp);
- drawoutcount();
- }
- }
- }
- #endif
- if (!twp->modflg)
- /* no need for updates*/
- continue;
-
- /* reset output context */
- getcontext(twp);
-
- if (twp->ibm_mode) {
- if (twp->event_reg & SCREEN_EVENT) {
- /* update the 3270 screen if EOR has been received */
- (*twp->screen_upd)();
- twp->modflg = modflg;
- twp->clrflg = clrflg;
- /* update modflg which may have changed */
- #ifdef DUALTCP
- if (twp->conntype == CONN_CUTCP)
- /* Cornell tcp needs frequent attention */
- datayield();
- #endif
- }
- continue;
- }
- else {
- if (twp->modflg) {
- (*twp->screen_upd)();
- twp->modflg = modflg;
- twp->clrflg = clrflg;
- #ifdef DUALTCP
- if (twp->conntype == CONN_CUTCP)
- datayield();
- #endif
- }
- continue;
- }
- } /* end of loop through window structure array */
-
- /* update tick counters if necessary */
- if (cticks > tickstats)
- tickstats = cticks + 60;
-
- inscreen_service = FALSE;
- }
-
-
- /* respond to a window update event; the grafport is already set */
-
- updatewind_qd()
- {
- int oldfont;
- long omodflg;
- short color = emdp->color;
- GrafPtr oldport;
- int oldsize;
-
- if (emdp->backonly)
- return;
-
- oldfont = emwindow->txFont;
- oldsize = emwindow->txSize;
-
- GetPort(&oldport);
- SetPort(emwindow);
-
- TextSize(emdp->fontsize);
-
- omodflg = modflg; /* save; otherwise lines outside update rgn not redrawn */
- modflg = (long) SCRALLMOD; /* set line-changed map to all TRUE */
-
- /* blank out cursors before drawing: invert whole rect
- before setting cliprgn w/ beginupdate() */
- if (emdp == keydp && trackon) {
- InvertRect(&mouserect);
- }
- if (emdp->curson) {
- InvertRect(&emdp->cursrect);
- }
-
- emdp->mfwait = FALSE;
-
- BeginUpdate(emwindow);
-
- /* now when we invert again any portion in the update region will be inverted
- to blank... */
- if (emdp == keydp && trackon) {
- InvertRect(&mouserect);
- trackon = FALSE;
- }
- if (emdp->curson) {
- InvertRect(&emdp->cursrect);
- emdp->curson = FALSE;
- }
-
- prettywind(TRUE);
-
- if (line25on(emdp)) {
- line25refresh();
- }
- else {
- if (emdp->termset) {
- /* don't draw controls until there's a terminal selected */
- if (emdp->controlschanged || !emdp->dsdraw) {
- drawq1controls();
- copytoprect(emwindow); /* copy the control pics to reuse */
- }
- else
- pastetoprect(emwindow);
- }
- }
- drawversion("");
- drawincount();
- drawoutcount();
-
- oldfont = emwindow->txFont;
-
- if (emdp->selrectvis && !color) {
- /* if user has selected some text, invert it again within update clip */
- selinvert(emdp);
- }
- if (!emdp->emdisable) {
- /* update the emulator contents */
- if (emdp->ibm_mode)
- ibmpaintbuf(scr_map, color ? FALSE : TRUE);
- else
- paintbuf(&emdp->charr[0], color ? FALSE : TRUE);
- }
- if (emdp->selrectvis && color) {
- /* must be inverted promptly within update clip */
- selinvert(emdp);
- }
- TextFont(oldfont);
- if (color) {
- BackColor((long) whiteColor);
- ForeColor((long) blackColor);
- }
- if (emdp->ibm_keymode) {
- arcrefresh(); /* 3270ft bytes-transferred drawing */
- }
- if (emdp->ibm_mode) {
- status_info();
- }
- modflg = omodflg; /* restore modflg */
-
- EndUpdate(emwindow); /* end the update */
-
- InvertRect(&emdp->cursrect); /* turn the cursor on */
- emdp->curson = TRUE;
- setcursalarm();
- SetPort(oldport);
- }
-
-
- /*
- * write count bytes from srcptr to linear screen position dest;
- * do not move cursor
- */
-
- str_draw_qd(srcptr, count, attr)
- unsigned char * srcptr;
- register int count;
- unsigned char attr;
- {
- unsigned char thechar;
- int savex, savey;
- int oldfont;
- char invisible;
-
- if (updatewait()) {
- /* delay drawing */
- modflg |= SCRALLMOD; /* for convenience we redraw the whole thing */
- emdp->event_reg |= SCREEN_EVENT;
- return;
- }
-
- savex = xpos;
- savey = ypos;
-
- ypos = (srcptr - scr_map) / emdp->linelength;
- xpos = (srcptr - scr_map) - (ypos * emdp->linelength);
-
- oldfont = emwindow->txFont;
-
- invisible = setscreenattr_qd(attr);
-
- prepibmdraw_qd();
- count++; /* set up for predecrement */
- clrflg &= ~modmask[ypos]; /* reset clear flag */
-
- while (--count > 0)
- {
- if (invisible) {
- /* blank the character */
- thechar = ' ';
- srcptr++;
- }
- else {
- thechar = *srcptr++;
- }
- ibmpaintchar(thechar);
- if (++xpos >= emdp->linelength) {
- xpos = 0;
- clrflg &= ~modmask[ypos]; /* reset clear flag */
- if (++ypos >= emdp->linecount)
- ypos = 0;
- }
- }
-
- /* restore the old x, y values and the old cursor */
- xpos = savex;
- ypos = savey;
- endibmdraw_qd();
- TextFont(oldfont);
- if (emdp->color) {
- BackColor((long) whiteColor);
- ForeColor((long) blackColor);
- }
- }
-
-
- /* draw a character on the screen; fix cursor later after cursor_ptr update */
-
- ibmch_draw_qd(thechar, attr)
- unsigned char thechar;
- unsigned char attr;
- {
- int oldfont;
- int oldsize;
-
- if (updatewait()) {
- /* delay drawing */
- set_mod(cursor_ptr, 1);
- emdp->event_reg |= SCREEN_EVENT;
- return;
- }
-
- oldfont = emwindow->txFont;
- oldsize = emwindow->txSize;
-
- if (setscreenattr_qd(attr))
- /* invis, blank the character */
- thechar = ' ';
-
- prepibmdraw_qd();
-
- /* do it */
- ibmpaintchar(thechar);
- clrflg &= ~modmask[ypos]; /* reset clear flag */
-
- endibmdraw_qd();
-
- TextFont(oldfont);
- TextSize(oldsize);
- if (emdp->color) {
- BackColor((long) whiteColor);
- ForeColor((long) blackColor);
- }
- }
-
-
- /* called to update chars on screen after host has modified */
-
- screen_upd_qd()
- {
- GrafPtr oldport;
- int oldfont;
- int oldsize;
- int doinvert = TRUE;
- short hadcursor;
-
- if (updatewait())
- return;
-
- if (emdp->backonly)
- return;
-
- oldfont = emwindow->txFont;
- oldsize = emwindow->txSize;
-
- GetPort(&oldport);
- SetPort(emwindow);
-
- TextSize(emdp->fontsize);
-
- if (emdp->color && emdp->selrectvis) {
- /* must clear the selection and re-invert later since color QD
- makes it difficult to handle this; delivers blocky
- performance */
- selinvert(emdp);
- doinvert = FALSE;
- }
- hadcursor = emdp->curson;
- if (emdp->ibm_mode) {
- prepibmdraw_qd();
- ibmpaintbuf(scr_map, doinvert);
- endibmdraw_qd();
- emdp->event_reg &= ~SCREEN_EVENT;
- }
- else {
- emprep();
- paintbuf(&emdp->charr[0], doinvert);
- emend();
-
- }
- if (hadcursor) {
- /* if the cursor was visible, make sure it stays that way */
- InvertRect(&emdp->cursrect); /* turn the cursor on */
- emdp->curson = TRUE;
- setcursalarm();
- }
-
- if (emdp->color && emdp->selrectvis) {
- /* make sure the selection rectangle gets inverted */
- tm_tset(2, selrestore, emdp, emdp->sel_tm);
- emdp->selrectvis = FALSE; /* it was cleared earlier */
- }
-
- TextFont(oldfont);
- TextSize(oldsize);
- if (emdp->color) {
- BackColor((long) whiteColor);
- ForeColor((long) blackColor);
- }
- SetPort(oldport);
- }
-
-
- /*
- ***** quick clear the first 24 lines off the screen
- */
-
- clear_scr_qd()
- {
- if (updatewait()) {
- /* had emdp->color || too before EraseRect changed to clearrect */
- modflg = emdp->modflg = SCRALLMOD;
- emdp->event_reg |= SCREEN_EVENT;
- return;
- }
-
- if (clrflg >= SCRALLMOD)
- /* screen is already clear */
- return;
-
- emdp->bigrect.top = emdp->voffset;
- clearrect(&emdp->bigrect);
- if (emdp->selrectvis) {
- /* if user has selected some text, we must rehighlight */
- if (updatewait()) {
- emdp->selrectvis = FALSE;
- tm_tset(2, selrestore, emdp, emdp->sel_tm);
- }
- else
- selinvert(emdp);
- }
- clrflg = SCRALLMOD;
-
- emdp->curson = FALSE;
- if (emdp == keydp)
- trackon = FALSE;
- }
-
- prepibmdraw_qd()
- {
- if (emdp->curson) {
- /* if cursor visible, invert it */
-
- InvertRect(&emdp->cursrect);
- emdp->curson = FALSE;
- }
- if (emdp == keydp && trackon) {
- /* if mouserect visible, invert it */
-
- InvertRect(&mouserect);
- trackon = FALSE;
- }
- }
-
-
- endibmdraw_qd()
- {
- showcursor();
- }
-
-
- ibmpaintchar(thechar)
- char thechar;
- {
- Rect chinvrect;
- int fixinv;
-
- fixinv = FALSE;
- chinvrect.top = ypos * emdp->lineheight + emdp->voffset;
- chinvrect.left = xpos * emdp->fontwidth + emdp->hoffset;
-
- MoveTo(chinvrect.left, chinvrect.top + emdp->lineheight - emdp->fontdescent);
- if (fixinv = chkinvert()) {
- if (!emdp->color)
- TextMode(notSrcCopy);
- }
- DrawChar(thechar);
- if (fixinv) {
- if (emdp->color) {
- /* invert the newly drawn character */
- chinvrect.bottom = chinvrect.top + emdp->fontheight; /* - 2 skipped by zap */
- chinvrect.right = chinvrect.left + emdp->fontwidth;
-
- InvertRect(&chinvrect);
- }
- else
- TextMode(srcCopy);
- }
- }
-
- /* redraws the characters on the screen from a screen buffer.
- Due to the line leading, window updates need to have the inversion
- of the selection range done on the whole range--inverted char drawing
- would leave non-inverted bit rows.
- */
-
- ibmpaintbuf(scrbuf, invert)
- unsigned char * scrbuf;
- int invert;
- {
- register unsigned char * textp;
- register unsigned char * drawstart;
- register unsigned char * lineend;
-
- register unsigned char thechar;
- register unsigned int dodraw; /* draw triggered by entering selection range */
- unsigned int invisible; /* we're in an invisible field */
- int doinvert = invert;
-
- /* here are some blank-skipping vars which are irrelevant when color,
- since color spaces may have a different background color */
- register unsigned int blanks = 0; /* # blanks not to draw */
- register unsigned int diacritics = 0; /* # diacritics to draw spaces for */
- unsigned long lineclr;
- char zapped = FALSE;
-
- unsigned char attr;
- unsigned char * attp;
- int yloc;
- int linecount;
- unsigned long linemod;
- int notstart; /* start of selection range */
- int notcount; /* count of selection range */
- unsigned char inselection = FALSE; /* in selection range */
- int textmode = srcCopy;
- int drawcount;
-
- dodraw = FALSE;
-
- yloc = emdp->lineheight - emdp->fontdescent + emdp->voffset; /* pen vert pos */
- textp = scrbuf;
-
- /* find and set current attribute */
- if (*scrbuf < ATTR)
- attr = *scrbuf;
- else {
- attp = look_attr(scrbuf, BACK);
- attr = *attp;
- }
- invisible = setscreenattr_qd(attr);
- if (invert) {
- if (emdp->selrectvis) {
- /* calculate character range over which we use notSrcCopy */
- notstart = emdp->selystart * emdp->linelength + emdp->selxstart;
- notcount = emdp->selyend * emdp->linelength + emdp->selxend - notstart;
- if (notcount == 0)
- doinvert = FALSE;
- }
- else
- doinvert = FALSE;
- }
- TextMode(srcCopy);
-
- #ifdef CLEARONALLMOD
- /* alas this mode looks jerkier; it does speed things up w/ SKIPBLANKS on */
- if (modflg == SCRALLMOD) {
- /* screen was completely modified, clearing will speed blanks */
- clear_scr_qd();
- }
- #endif
-
- lineend = textp + emdp->linelength;
- for (linecount = 0; linecount <= emdp->lastrow; linecount++, lineend += emdp->linelength) {
-
- linemod = modflg & modmask[linecount];
- lineclr = clrflg & modmask[linecount];
-
- if (linemod) {
- MoveTo(emdp->hoffset, yloc);
- drawstart = textp;
- }
-
- for ( ; textp < lineend; textp++) {
- if (doinvert) {
- /* check to see if we're in the selection range */
- if (notstart-- == 0) {
- /* we just entered the range */
- dodraw = TRUE;
- inselection = TRUE;
- }
- if (notstart < 0) {
- /* we have entered the range */
- if (notcount-- == 0) {
- /* we just left it */
- dodraw = TRUE;
- inselection = FALSE;
- doinvert = FALSE;
- }
- }
- }
- thechar = *textp;
- if ( ((thechar) < ATTR) || dodraw) {
- /* we hit a new attribute or selection range, draw a string now */
-
- if (linemod) {
- drawcount = textp - drawstart - blanks;
- if (drawcount > 0) {
- #ifdef SCRHILITE
- if (inselection)
- SETHILITE();
- #endif
- DrawText(invisible ? blankstart : drawstart, 0, drawcount);
- zapped = TRUE;
- }
- if (blanks) {
- /* only accumulate when line is cleared so we can skip */
- Move(blanks * emdp->fontwidth, 0);
- blanks = 0;
- }
- if (diacritics) {
- DrawText(blankstart, 0, diacritics);
- diacritics = 0;
- }
- drawstart = textp;
- }
- if (dodraw) {
- /* may be transiting selection range, set new mode & reset flag */
- dodraw = FALSE;
- if (!emdp->color)
- TextMode((textmode = (inselection ? notSrcCopy : srcCopy)));
- }
- if (thechar < ATTR) {
- /* hit a new attribute, put a blank down & switch font */
- if (linemod) {
- #ifdef SCRHILITE
- if (inselection)
- SETHILITE();
- #endif
- DrawChar(' ');
- drawstart++;
- }
- invisible = setscreenattr_qd(thechar);
- }
- }
- else if (!emdp->color && lineclr) {
- if (skiparr[*textp] && textmode == srcCopy) {
- /* add up consecutive blanks at right end */
- blanks++;
- continue;
- }
- else if (blanks > 2) {
- /* we'll break up line into smaller frags but will skip more
- spaces, an OK trade? */
- --textp; /* back up to catch this char again */
- dodraw = TRUE;
- continue;
- }
- else
- blanks = 0;
- }
- diacritics += isdiacritic[thechar];
- }
- /* clean up any drawing needed for the rest of the line */
- if (linemod && drawstart < lineend) {
- /* make sure we draw even when attribute at end of line */
- drawcount = textp - drawstart - blanks;
- if (drawcount > 0) {
- #ifdef SCRHILITE
- if (inselection)
- SETHILITE();
- #endif
- DrawText(invisible ? blankstart : drawstart, 0, drawcount);
- zapped = TRUE;
- }
- }
- blanks = 0;
- if (diacritics) {
- /* blank out stuff */
- DrawText(blankstart, 0, diacritics);
- diacritics = 0;
- }
- if (zapped) {
- clrflg &= ~modmask[linecount]; /* reset clear flag */
- zapped = FALSE;
- }
- yloc += emdp->lineheight;
- /* fix for the next time around */
- }
- TextMode(srcCopy);
- modflg = 0;
- }
-
- /* resize the emulator screen and its textwindow */
-
- setscreensize(fsize)
- int fsize;
- {
-
- int dv;
- int dh;
- int emv; /* emulator height */
- int emh; /* emulator width */
- short odsdraw = emdp->dsdraw;
-
- if (emdp->ibm_mode)
- (*emdp->prepibmdraw)();
- else
- emprep();
-
- /* .h .v
- 480, 288 original 9 pt dimensions
- 560, 384 12 pt
- 640, 336 14 pt
-
- + 29, + 30 for controls & stuff
- */
-
- setfontsize(fsize);
-
- emh = (emdp->lastcol + 1) * emdp->fontwidth + 2 * emdp->hoffset;
- dh = emh + 29
- - (((GrafPtr) emwindow)->portRect.right
- - ((GrafPtr) emwindow)->portRect.left);
-
- emv = (emdp->lastrow + 1) * emdp->lineheight + emdp->voffset;
- dv = emv + 30
- - (((GrafPtr) emwindow)->portRect.bottom
- - ((GrafPtr) emwindow)->portRect.top);
-
- prettyresize(dh, dv);
- textwsize(emh + 28, emv + 12); /* resize the text window */
- SizeWindow(emwindow, emh + 29, emv + 30, (Boolean) FALSE);
-
- InvalRect(&((GrafPtr) emwindow)->portRect);
- ClipRect(&((GrafPtr) emwindow)->portRect);
-
- if (windtightfit(emdp) || !indisplay(emwindow) ) {
- /* if the window is not in the display, move if it necessary */
- fitwindow(emdp);
- }
- setcontext(emdp); /* reset globals before testds which may savecontext() */
- testds(emdp);
- /* useds() will be called if true */
-
- if (emdp->selrectset) {
- /* resize selection rectangles */
- selset(emdp->selystart, emdp->selxstart, emdp->selyend, emdp->selxend);
- emdp->selrectvis = TRUE;
- /* have update handler redraw */
- }
- newcurs(&emdp->cursrect); /* reposition the cursor */
-
- if (emdp->ibm_mode) {
- if (odsdraw)
- endibmdraw_ds();
- else
- endibmdraw_qd();
- }
- else
- emend();
-
- showcursor();
- }
-
-
- /* sets variables dependent upon font size */
-
- setfontsize(fsize)
- int fsize;
- {
- FontInfo fontinfo; /* font information */
-
- if (fsize == 9) {
- emdp->hoffset = 0;
- emdp->voffset = 0;
- }
- else if (fsize == 12) {
- emdp->hoffset = 0;
- emdp->voffset = 0;
- }
- else if (fsize == 14) {
- emdp->hoffset = 6;
- emdp->voffset = 0;
- }
- else if (fsize == 16) {
- emdp->hoffset = 6;
- emdp->voffset = 0;
- }
- else {
- /* default to size 9 */
- fsize = 9;
- emdp->hoffset = 0;
- emdp->voffset = 0;
- }
- TextSize(fsize);
- emdp->fontsize = fsize;
-
- GetFontInfo(&fontinfo);
- emdp->lineheight = fontinfo.ascent + fontinfo.descent + fontinfo.leading;
- emdp->fontheight = fontinfo.ascent + fontinfo.descent;
- emdp->fontdescent = fontinfo.descent + fontinfo.leading;
-
- emdp->fontwidth = CharWidth('m');
- /* use the width of an em as the default width */
-
- /* these are offsets not relying on voffset */
- emdp->curstop = emdp->lineheight - 1;
- emdp->mrecttop = emdp->lineheight - 2 ;
-
- /* fix emdp->rightmarg, emdp->bigrect, & emdp->scrollrect for emulators */
-
- emdp->rightmarg = emdp->fontwidth * (emdp->lastcol + 1) + emdp->hoffset;
- emdp->bottommarg = emdp->lineheight * emdp->linecount + emdp->voffset;
-
- emdp->bigrect.top = emdp->voffset;
- emdp->bigrect.left = emdp->hoffset;
- emdp->bigrect.bottom = emdp->bottommarg;
- emdp->bigrect.right = emdp->rightmarg;
-
- emdp->scrollrect.top = emdp->scrolltop * emdp->lineheight + emdp->voffset;
- emdp->scrollrect.left = emdp->hoffset;
- emdp->scrollrect.bottom = (emdp->scrollbottom + 1) * emdp->lineheight + emdp->voffset;
- emdp->scrollrect.right = emdp->rightmarg;
-
- }
-
-
-
- /* handle a window update event in direct-screen drawing mode */
-
- updatewind_ds()
- {
- RgnHandle tvisRgn;
- Rect intersect;
- GrafPtr oldport;
- Rect wrect;
-
- if (emdp->backonly)
- return;
-
- if (bkrd_act || !dsdrawok()) {
- /* emdp->selrectvis || do a quickdraw update if in background */
- updatewind_qd();
- return;
- }
- if (!((WindowPeek) emwindow)->visible) {
- return;
- }
-
- GetPort(&oldport);
- SetPort(emwindow);
-
- /* blank out cursors before drawing: invert whole rect
- before setting cliprgn w/ beginupdate() */
- if (emdp == keydp && trackon) {
- InvertRect(&mouserect);
- }
- if (emdp->curson) {
- InvertRect(&emdp->cursrect);
- }
-
- emdp->mfwait = FALSE;
-
- BeginUpdate(emwindow);
-
- /* now when we invert again any portion in the update region will be inverted
- to blank... */
- /* we do prepibmdraw stuff again... */
- prepibmdraw_ds();
-
- prettywind(TRUE);
-
- if (line25on(emdp)) {
- line25refresh();
- }
- else {
- if (emdp->termset) {
- /* don't draw controls until there's a terminal selected */
- if (emdp->controlschanged) {
- drawq1controls();
- copytoprect(emwindow); /* try to copy the control pics to reuse */
- }
- else
- pastetoprect(emwindow);
- }
- }
- drawversion("");
- drawincount();
- drawoutcount();
- /*
- wrect = emdp->bigrect;
- LocalToGlobal(&wrect.top);
- LocalToGlobal(&wrect.bottom);
- */
- if (SectRect(&emdp->bigrect, &(*emwindow->visRgn)->rgnBBox, &intersect)) {
- /* update the em screen only if it needs it; thus
- we can avoid undue screen glitching on minor update events... */
- modflg = (long) SCRALLMOD; /* set line-changed map to all TRUE */
- }
- if (modflg) {
- if (emdp->selrectvis) {
- /* if user has selected some text, invert it again within update clip
- before ds redraw; this results in poor performance...
- reinvert update rgn, blank all, reinvert all */
- selinvert(emdp);
- }
- if (!emdp->emdisable) {
- /* update the emulator contents */
- if (emdp->ibm_mode) {
- if (emdp->selrectvis || emdp->fontwidth == 8) {
- ibmdsbuf(scr_map, TRUE);
- }
- else {
- zapbuf(scr_map);
- }
- }
- else {
- emprep();
- emrefresh(emwindow, TRUE);
- emend();
- }
- modflg = 0;
- }
- if (emdp->ibm_keymode) {
- arcrefresh(); /* 3270ft bytes-transferred drawing */
- }
- }
-
- if (emdp->ibm_mode) {
- status_info();
- }
-
- emdp->event_reg &= ~SCREEN_EVENT; /* the screen has been completely updated */
-
- EndUpdate(emwindow); /* end the update */
-
- InvertRect(&emdp->cursrect); /* turn the cursor on */
- emdp->curson = TRUE;
- setcursalarm();
-
- endibmdraw_ds();
- SetPort(oldport);
- }
-
-
- /* new function to replace msg_out
- * uses linear destination parameter rather than xpos, ypos to consolidate
- * arithmetic
- *
- * write count bytes from srcptr to linear screen position dest
- * do not move cursor
- */
-
- str_draw_ds(srcptr, count, attr)
- unsigned char * srcptr;
- register int count;
- unsigned char attr;
- {
- FONTS * oldfont;
- unsigned char thechar;
- int savex, savey;
- char invisible = FALSE;
- char invertdone = FALSE;
- Byte mmumode;
-
- if (updatewait()) {
- /* delay drawing */
- set_mod(srcptr, count);
- emdp->event_reg |= SCREEN_EVENT;
- return;
- }
- if (bkrd_act || !dsdrawok()) {
- str_draw_qd(srcptr, count, attr);
- return;
- }
- else if (!((WindowPeek) emwindow)->visible)
- return;
-
-
- oldfont = thefont;
- savex = xpos;
- savey = ypos;
-
- ypos = (srcptr - scr_map) / emdp->linelength;
- xpos = (srcptr - (scr_map + (ypos * emdp->linelength)));
-
- prepibmdraw_ds();
- invisible = setscreenattr_ds(attr);
-
- count++; /* set up for predecrement */
- clrflg &= ~modmask[ypos]; /* reset clear flag */
-
- #ifdef SWAPMMUMODE
- mmumode = true32b; /* set MMU mode to 32 bits so high screen addresses OK */
- SwapMMUMode(&mmumode); /* NB: V-592: "some Toolbox routines may not function" */
- #endif
-
- while (--count > 0)
- {
- if (invisible) {
- thechar = ' ';
- srcptr++;
- }
- else
- thechar = *srcptr++;
- /* draw using an inverted font when within selection range */
- if (emdp->selrectvis) {
- if (zapinvert) {
- if (!invertdone && !chkinvert()) {
- /* we just left the selection range, reset the font */
- setscreenattr_ds(attr);
- invertdone = TRUE;
- zapinvert = FALSE;
- }
- }
- else {
- if (chkinvert()) {
- /* draw using an inverted font */
- if (thefont == &boldfont)
- thefont = &invboldfont;
- else
- thefont = &invfont;
- zapinvert = TRUE;
- }
- else
- zapinvert = FALSE;
- }
- }
- zapchar(thechar);
-
- if (++xpos >= emdp->linelength) {
- xpos = 0;
- clrflg &= ~modmask[ypos]; /* reset clear flag */
- if (++ypos >= emdp->linecount)
- ypos = 0;
- }
- }
-
- #ifdef SWAPMMUMODE
- SwapMMUMode(&mmumode); /* restore previous MMUMode */
- #endif
-
- /* restore the old x, y values and the old cursor */
- xpos = savex;
- ypos = savey;
- thefont = oldfont;
- }
-
-
- /* draw a character on the screen; fix cursor later after cursor_ptr update */
-
- ibmch_draw_ds(thechar, attr)
- unsigned char thechar;
- unsigned char attr;
- {
- FONTS * oldfont;
- Byte mmumode;
-
- if (updatewait()) {
- /* delay drawing */
- set_mod(cursor_ptr, 1);
- emdp->event_reg |= SCREEN_EVENT;
- return;
- }
- if (bkrd_act || !dsdrawok()) {
- ibmch_draw_qd(thechar, attr);
- return;
- }
- else if (!((WindowPeek) emwindow)->visible)
- return;
-
- oldfont = thefont;
- if (setscreenattr_ds(attr))
- /* invisible */
- thechar = ' ';
-
- prepibmdraw_ds();
-
- if (chkinvert()) {
- /* draw using an inverted font for better appearance */
- if (thefont == &boldfont)
- thefont = &invboldfont;
- else
- thefont = &invfont;
- zapinvert = TRUE;
- }
- else
- zapinvert = FALSE;
-
- #ifdef SWAPMMUMODE
- mmumode = true32b; /* set MMU mode to 32 bits so high addresses OK */
- SwapMMUMode(&mmumode); /* NB: V-592: "some Toolbox routines may not function" */
- #endif
-
- zapchar(thechar);
- clrflg &= ~modmask[ypos]; /* reset clear flag */
-
- #ifdef SWAPMMUMODE
- SwapMMUMode(&mmumode);
- #endif
-
- endibmdraw_ds();
- thefont = oldfont;
- }
-
-
-
- screen_upd_ds()
- {
- if (updatewait())
- return;
-
- if (bkrd_act || !dsdrawok()) {
- /* emdp->selrectvis was also a case ... */
- screen_upd_qd();
- return;
- }
- else if (!((WindowPeek) emwindow)->visible)
- return;
-
- emdp->event_reg &= ~SCREEN_EVENT;
- #ifdef BITSELDRAW
- if (emdp->selrectvis) {
- /* if user has selected some text, we must clear and rehighlight later */
- selclear(emdp);
- emdp->selrectvis = FALSE;
- tm_tset(12, selrestore, emdp, emdp->sel_tm);
- }
- #endif
- if (emdp->ibm_mode) {
- prepibmdraw_ds();
- if (emdp->selrectvis || emdp->fontwidth == 8) {
- /* do a zapchar deal like emrefresh... */
- ibmdsbuf(scr_map, TRUE);
- }
- else {
- /* TODO may have wrong font because attr not set! */
- zapbuf(scr_map);
- }
- endibmdraw_ds();
- }
- else {
- short hadcursor;
-
- hadcursor = emdp->curson;
-
- emprep();
- emrefresh(emwindow, TRUE);
- emend();
-
- if (hadcursor) {
- /* if the cursor was visible, make sure it stays that way */
- InvertRect(&emdp->cursrect); /* turn the cursor on */
- emdp->curson = TRUE;
- setcursalarm();
- }
- }
- }
-
-
- /*
- ***** quick clear the first 24 lines off the screen
- */
-
- clear_scr_ds()
- {
- if (updatewait()) {
- modflg = SCRALLMOD;
- emdp->event_reg |= SCREEN_EVENT;
- return;
- }
-
- if (clrflg >= SCRALLMOD)
- /* screen is already clear */
- return;
-
- if (mousecurson) {
- HideCursor();
- mousecurson = FALSE;
- }
-
- emdp->bigrect.top = emdp->voffset;
- EraseRect(&emdp->bigrect);
- if (emdp->selrectvis) {
- /* if user has selected some text, we must rehighlight */
- if (updatewait()) {
- emdp->selrectvis = FALSE;
- tm_tset(2, selrestore, emdp, emdp->sel_tm);
- }
- else
- selinvert(emdp);
- }
- emdp->curson = FALSE;
-
- clrflg = SCRALLMOD;
- if (emdp == keydp)
- trackon = FALSE;
-
- }
-
- prepibmdraw_ds()
- {
- if (mousecurson) {
- ShieldCursor(&emdp->zaprect, 0L);
- /* 0L equivalent to pass(Point(0,0)) */
- /* HideCursor(); */
- mousecurson = FALSE;
- }
- if (emdp->curson) {
- /* if cursor visible, invert it */
- InvertRect(&emdp->cursrect);
- emdp->curson = FALSE;
- }
- if (emdp == keydp && trackon) {
- /* if mouserect visible, invert it */
- InvertRect(&mouserect);
- trackon = FALSE;
- }
- zapuline = FALSE;
- zapinvert = FALSE;
- }
-
-
- endibmdraw_ds()
- {
- if (!mousecurson) {
- /* if (!mfbackground)
- ObscureCursor(); hide until next motion */
- ShowCursor();
- mousecurson = TRUE;
- }
- }
-
-
- /* are we in the selection range and do need to invert
- the character we just drew? */
-
- chkinvert()
- {
- int fixinv;
-
- fixinv = FALSE;
- if (emdp->selrectvis) {
- if (ypos == emdp->selystart && ypos == emdp->selyend) {
- /* on a single line */
- if (xpos >= emdp->selxstart && xpos < emdp->selxend)
- fixinv = TRUE;
- }
- else if (ypos == emdp->selystart) {
- /* might be in selection */
- if (xpos >= emdp->selxstart)
- fixinv = TRUE;
- }
- else if (ypos == emdp->selyend) {
- /* might be in selection */
- if (xpos < emdp->selxend)
- fixinv = TRUE;
- }
- else if (ypos > emdp->selystart && ypos < emdp->selyend) {
- /* definitely in selection */
- fixinv = TRUE;
- }
- }
- #ifdef ZANY
- /* removed to fix vt100... */
- if (fixinv)
- zapinvert = TRUE;
- else
- zapinvert = FALSE;
- #endif
- return(fixinv);
- }
-
-
- /* redraws the characters on the screen from a screen buffer.
- Due to the line leading, window updates need to have the inversion
- of the selection range done on the whole range--inverted char drawing
- would leave non-inverted bit rows.
-
- ibmdsbuf specializes in drawing an update with a selection range
- */
-
- ibmdsbuf(scrbuf, doinvert)
- unsigned char * scrbuf;
- short doinvert;
- {
- register unsigned char * textp;
- register unsigned char * lineend;
- register unsigned long linemod;
- register int notstart; /* start of selection range */
- register int notcount; /* count of selection range */
- register unsigned char thechar;
- register int dodraw; /* draw triggered by entering selection range */
- register unsigned long lineclr;
-
- unsigned char * attp;
- unsigned char attr;
- int invisible; /* we're in an invisible field */
- FONTS * oldfont;
- int savex = xpos;
- int savey = ypos;
- char zapped = FALSE;
- Byte mmumode;
-
- textp = scrbuf;
- xpos = 0;
-
- invisible = FALSE;
-
- /* find and set current attribute */
- if (*scrbuf < ATTR)
- thechar = *scrbuf;
- else {
- attp = look_attr(scrbuf, BACK);
- attr = *attp;
- }
- dodraw = TRUE; /* force attr selection first time through */
- oldfont = thefont;
- if (doinvert) {
- if (emdp->selrectvis) {
- /* calculate character range over which we use notSrcCopy */
- notstart = emdp->selystart * emdp->linelength + emdp->selxstart;
- notcount = emdp->selyend * emdp->linelength + emdp->selxend - notstart;
- if (notcount == 0)
- doinvert = FALSE;
- }
- else
- doinvert = FALSE;
- }
- #ifdef CLEARONALLMOD
- if (modflg == SCRALLMOD) {
- /* screen was completely modified, clearing will speed blanks */
- clear_scr_ds();
- }
- #endif
-
- #ifdef SWAPMMUMODE
- mmumode = true32b; /* set MMU mode to 32 bits so high addresses OK */
- SwapMMUMode(&mmumode); /* NB: V-592: "some Toolbox routines may not function" */
- #endif
-
- lineend = textp + emdp->linelength;
- for (ypos = 0; ypos <= emdp->lastrow; ypos++, lineend += emdp->linelength) {
- linemod = modflg & modmask[ypos];
- lineclr = clrflg & modmask[ypos];
-
- for ( ; textp < lineend; textp++, xpos++) {
- thechar = *textp;
- if (doinvert) {
- /* check to see if we're in the selection range */
- if (notstart-- == 0) {
- /* we just entered the range */
- dodraw = TRUE;
- zapinvert = TRUE;
- }
- if (notstart < 0) {
- /* we have entered the range */
- if (notcount-- == 0) {
- /* we just left it */
- dodraw = TRUE;
- zapinvert = FALSE;
- doinvert = FALSE;
- }
- }
- }
- if (thechar < ATTR) {
- attr = thechar;
- dodraw = TRUE;
- }
- if (dodraw) {
- /* hit a new attribute, put a blank down & switch font */
- dodraw = FALSE;
- switch (attr & DSPD) {
- case 0:
- /* normal, not selector-pen detectable */
- case 4: {
- /* normal, selector-pen detectable */
- thefont = (zapinvert ? &invfont : &font);
- invisible = FALSE;
- break;
- }
- case 8: {
- /* intense */
- thefont = (zapinvert ? &invboldfont : &boldfont);
- invisible = FALSE;
- break;
- }
- case 12: {
- /* invisible */
- invisible = TRUE;
- break;
- }
- }
- if (thechar < ATTR)
- /* make sure it was an attribute that triggered drawing */
- thechar = ' ';
- }
- if (linemod) {
- if (lineclr && !zapinvert && skiparr[thechar]) {
- /* we don't need to draw blanks */
- continue;
- }
- if (invisible) {
- thechar = ' ';
- }
- zapchar(thechar);
- zapped = TRUE;
- }
- }
- if (zapped) {
- clrflg &= ~modmask[ypos]; /* reset cleared flag */
- zapped = FALSE;
- }
- xpos = 0;
- }
- #ifdef SWAPMMUMODE
- SwapMMUMode(&mmumode);
- #endif
-
- xpos = savex;
- ypos = savey;
- thefont = oldfont;
- zapinvert = FALSE;
- modflg = 0;
- }
-
-
- /* cursor handling routines for both drawing styles */
-
- /* fix the rect arg to make a proper cursor at the current location
- * of cursor_ptr
- */
-
- ibmnewcurs(thecursor)
- Rect * thecursor;
- {
-
- ypos = (cursor_ptr - scr_map) / emdp->linelength;
- xpos = (cursor_ptr - (scr_map + (ypos * emdp->linelength)));
-
- newcurs(thecursor);
- }
-
-
- /* recalculate cursor rectangle and see if we can draw it */
-
- setibmcursor()
- {
- if ((!mfbackground && bkrd_act) || updatewait()) {
- /* don't invert cursor while in background */
- ypos = (cursor_ptr - scr_map) / emdp->linelength;
- xpos = (cursor_ptr - (scr_map + (ypos * emdp->linelength)));
- emdp->cursorwait = TRUE;
- return();
- }
- if (emdp->curson) {
- /* turn off old cursor */
- InvertRect(&emdp->cursrect);
- }
- ibmnewcurs(&emdp->cursrect);
- InvertRect(&emdp->cursrect);
- emdp->curson = TRUE;
- setcursalarm();
- }
-
-
- /* set new cursor but don't draw it yet */
-
- newibmcursor()
- {
- if ((!mfbackground && bkrd_act) || updatewait()) {
- /* don't invert cursor while in background */
- ypos = (cursor_ptr - scr_map) / emdp->linelength;
- xpos = (cursor_ptr - (scr_map + (ypos * emdp->linelength)));
- emdp->cursorwait = TRUE;
- return();
- }
- if (emdp->curson) {
- InvertRect(&emdp->cursrect);
- emdp->curson = FALSE;
- }
- ibmnewcurs(&emdp->cursrect);
- }
-
-
- /* called to refresh IBM keyboard lights */
-
- status_info()
- {
- /* called when screen needs to be updated */
-
- if (emdp->event_reg & SYS_LOCK)
- showsyslock();
-
- if (emdp->event_reg & KYBD_LOCK)
- showkbdlock();
- }
-
-
- clrstatus_info()
- {
- /* called when screen needs to be updated */
-
- if (emdp->event_reg & SYS_LOCK)
- clrsyslock();
-
- if (emdp->event_reg & KYBD_LOCK)
- clrkbdlock();
- }
-
-
- /* Cause the cursor to blink if blinking is on;
- Also turns Macintosh cursor back on if it has been hidden.
- */
-
- cursorblink()
- {
- if (!mousecurson) {
- showcursor();
- }
- /* do nothing if an update is pending, in background, or terminal
- type not yet selected */
- if ((!mfbackground && bkrd_act) || updatewait()) {
- /* ^ implies the q3labels are up, DON'T invert the cursor */
- return;
- }
-
- if (emdp->cursorwait) {
- /* update the cursor so it's in the current position */
- emdp->cursorwait = FALSE;
- if (emdp->ibm_mode)
- setibmcursor();
- else
- setcursor();
- }
- else {
- if (emdp->changecurs) {
- /* we assume we are only called every blink time */
- if (emdp->curson) {
- if (!bkrd_act && emdp->connopen) {
- /* it's now off if we're not in the background
- and have a connection */
- emdp->curson = FALSE;
- InvertRect(&emdp->cursrect);
- }
- }
- else {
- /* turn it on */
- emdp->curson = TRUE;
- InvertRect(&emdp->cursrect);
- }
- }
- else if (emdp->curson == FALSE) {
- emdp->curson = TRUE;
- InvertRect(&emdp->cursrect);
- }
- }
- }
-
-
- /* set QuickDraw drawing state to correspond to current attribute */
-
- setscreenattr_qd(attr)
- unsigned char attr;
- {
- int invisible = FALSE;
- int protected = 0;
- int field = ATNORM;
-
- if (emdp->color && (attr & PROT)) {
- /* protected fields show up in color */
- protected = ATPROT;
- }
- switch (attr & DSPD) {
- case 0: {
- /* normal, not selector-pen detectable */
- TextFont(emdp->normfont);
- field = ATNORM;
- break;
- }
- case 4: {
- /* normal, selector-pen detectable */
- TextFont(emdp->normfont);
- field = ATSENSE;
- break;
- }
- case 8: {
- /* intense */
- TextFont(emdp->highfont);
- field = ATINTENSE;
- break;
- }
- case 12: {
- /* invisible */
- TextFont(emdp->normfont);
- field = ATINVIS;
- invisible = TRUE;
- break;
- }
- }
- if (emdp->color) {
- RGBForeColor(&emdp->colormap.colors[field + protected]);
- RGBBackColor(&emdp->colormap.colors[field + protected + ATBACK]);
- }
- return(invisible);
- }
-
-
-
- setscreenattr_ds(attr)
- unsigned char attr;
- {
- int invisible = FALSE;
-
- switch (attr & DSPD) {
- case 0:
- /* normal, not selector-pen detectable */
- case 4: {
- /* normal, selector-pen detectable */
- thefont = &font;
- break;
- }
- case 8: {
- /* intense */
- thefont = &boldfont;
- break;
- }
- case 12: {
- /* invisible */
- invisible = TRUE;
- break;
- }
- }
- return(invisible);
- }
-
- /* was a useful code fragment */
- #ifdef CHARINVERT
- if (chkinvert()) {
- chinvrect.top = ypos * emdp->lineheight + 2; /* top 2 skipped by zap */
- chinvrect.left = xpos * emdp->fontwidth;
- chinvrect.bottom = chinvrect.top + emdp->fontheight - 2; /* - 2 skipped by zap */
- chinvrect.right = chinvrect.left + emdp->fontwidth;
-
- InvertRect(&chinvrect);
- }
- #endif
-
-
- /* set vectors to employ the direct-to-screen drawing routines
- and reset important variables
- */
-
- useds(twp)
- struct winds * twp;
- {
- extern int scrollup_ds();
-
- twp->dsdraw = TRUE;
-
- /* generic */
- twp->screen_upd = screen_upd_ds;
- twp->updatewind = updatewind_ds;
-
- /* IBM specific */
- twp->prepibmdraw = prepibmdraw_ds;
- twp->ch_draw = ibmch_draw_ds;
- twp->str_draw = str_draw_ds;
- twp->clear_scr = clear_scr_ds;
-
- /* ASCII */
- twp->scrollup = scrollup_ds;
-
- if (buildfonts(twp) || setlinestarts(twp))
- useqd(twp);
-
- setshield(twp);
-
- }
-
-
- /* set drawing routine pointers to point to quickdraw routines */
-
- useqd(twp)
- struct winds * twp;
- {
- extern int scrollup_qd();
-
- twp->dsdraw = FALSE;
-
- /* generic */
- twp->updatewind = updatewind_qd;
- twp->screen_upd = screen_upd_qd;
-
- /* IBM specific */
- twp->prepibmdraw = prepibmdraw_qd;
- twp->ch_draw = ibmch_draw_qd;
- twp->str_draw = str_draw_qd;
- twp->clear_scr = clear_scr_qd;
-
- /* ASCII */
- twp->scrollup = scrollup_qd;
- }
-
-
- /*
- Check to see if the visRgn is large enough (i.e. no windows in front of this
- one) so we can use direct to screen drawing; return TRUE if so.
-
- Replaces FrontWindow() test so multiple windows can run fast.
- */
-
- dsdrawok()
- {
- RgnPtr visrgn;
-
- if (!riskydsdraw) {
- if (emwindow == FrontWindow()) {
- return(TRUE);
- }
- }
- else {
- /* use the slightly unreliable visRgn, which doesn't always
- get updated quickly enough */
- visrgn = *((GrafPtr) emwindow)->visRgn;
- if (visrgn->rgnSize == 10) {
- /* the visible region is a rectangle */
- if ( (visrgn->rgnBBox.top <= emdp->bigrect.top)
- && (visrgn->rgnBBox.left <= emdp->bigrect.left)
- && (visrgn->rgnBBox.bottom >= emdp->bigrect.bottom)
- && (visrgn->rgnBBox.right >= emdp->bigrect.right)
- )
- /* and the region box encloses the bigrect display
- rectangle, so we can use direct to screen algorithm */
- return(TRUE);
- }
- }
- return(FALSE);
- }
-
-
-
- showcursor()
- {
- if (!mousecurson) {
- ShowCursor();
- mousecurson = TRUE;
- }
- }
-
-
- /* some general screen routines */
-
- /* fix the rect arg to make a proper cursor at the current location
- * of cursor_ptr
- */
-
- newcurs(thecursor)
- Rect * thecursor;
- {
- if (emdp->blockcurs) {
- thecursor->top = ypos * emdp->lineheight + 1 + emdp->voffset;
- thecursor->left = xpos * fontwidth + emdp->hoffset;
- thecursor->bottom = thecursor->top - 1 + emdp->lineheight;
- thecursor->right = thecursor->left + fontwidth;
- }
- else {
- thecursor->top = ypos * emdp->lineheight + emdp->curstop + emdp->voffset;
- thecursor->left = xpos * fontwidth + emdp->hoffset;
- thecursor->bottom = thecursor->top + 1;
- thecursor->right = thecursor->left + fontwidth;
- }
- }
-
-
- /* position a new cursor and draw it */
-
- setcursor()
- {
- if (emwindow == NULL)
- return;
-
- if ((!mfbackground && bkrd_act) || updatewait()) {
- /* don't invert cursor while in background () */
- emdp->cursorwait = TRUE;
- return;
- }
- if (emdp->curson) {
- /* turn off old cursor */
- InvertRect(&emdp->cursrect);
- }
- newcurs(&emdp->cursrect);
-
- InvertRect(&emdp->cursrect);
- emdp->curson = TRUE;
- setcursalarm();
- }
-
-
- /* position a new cursor without drawing it */
-
- newcursor()
- {
- if (emwindow == NULL)
- return;
-
- if ((!mfbackground && bkrd_act) || updatewait()) {
- /* don't invert cursor while in q3label background */
- emdp->cursorwait = TRUE;
- return;
- }
- if (emdp->curson) {
- InvertRect(&emdp->cursrect);
- emdp->curson = FALSE;
- }
- newcurs(&emdp->cursrect);
- }
-
-
- /* set the cursor to be turned on at the correct time */
-
- setcursalarm()
- {
- cursalarm = cticks + ((paramptr->volClick & 0x0f) << 2);
- /* set count between blinks to user parameter setting */
- }
-
-
- /* CURSOR support */
-
- emcursopen()
- {
- emdp->changecurs = TRUE;
- }
-
-
- emcursclose()
- {
- emdp->changecurs = FALSE;
- }
-
-
- /* timer upcall to restore the selection after it has been erased */
-
- selrestore(twp)
- struct winds * twp;
- {
- GrafPtr savegraf;
-
- if (twp->emwindow == NULL)
- return;
-
- if (updatewait() || twp->modflg) {
- /* arrange to be called back while waiting for update */
- tm_tset(2, selrestore, twp, twp->sel_tm);
- return;
- }
- GetPort(&savegraf);
- SetPort(twp->emwindow);
- /* re-highlight selection */
-
- selinvert(twp);
- twp->selrectvis = TRUE;
- SetPort(savegraf);
- }
-
-
-
-